home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group99a.txt / 000156_icon-group-sender _Sun Jul 18 15:22:32 1999.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id PAA07448
  4.     for icon-group-addresses; Sun, 18 Jul 1999 15:22:24 -0700 (MST)
  5. Message-Id: <199907182222.PAA07448@baskerville.CS.Arizona.EDU>
  6. X-Sender: memphis@popmail.macconnect.com
  7. Date: Wed, 14 Jul 1999 15:05:05 -0500
  8. To: icon-group@optima.CS.Arizona.EDU
  9. From: Garry <memphis@macconnect.com>
  10. Subject: Basename.icn in Library 9.3.2
  11. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  12. Status: RO
  13.  
  14. Am I not correct that it's not correct?
  15.  
  16. The implementation of Basename in release 9.3.1 was
  17.  
  18.    procedure basename(name, suffix)  #: base name of file
  19.       local i
  20.  
  21.       name ? {
  22.          every i := upto('/\\:')
  23.          tab(integer(i) + 1)             # get rid of path, if any
  24.          return tab(find(\suffix | ".") | 0) # return part before suffix, if any
  25.          }
  26.    end
  27.  
  28. In release 9.3.2 Basename has become a little "safer" ("Basename xyzzy.c  .cpp" returns  xyzzy.c  not  xyzzy) 
  29.  
  30.    procedure basename(name, suffix)  #: base name of file
  31.       local i, base
  32.  
  33.       name ? {
  34.          every i := upto('/\\:')
  35.          tab(integer(i) + 1)             # get rid of path, if any
  36.          if base := 1(tab(find(\suffix)),  pos(-*suffix)) then return base
  37.          else return tab(0)
  38.          }
  39.    end
  40.  
  41. I like the new version, it's the Basename that I know and love, but the behavior has actually changed and the documentation doesn't reflect that (so I don't know if the behavior is intended or not).  The file documentation says that
  42.    #  If no suffix is provided, the portion of the name up to the first
  43.    #  "." is returned.
  44.  
  45. I think that that is no longer true and that the new Basename returns the simple filename, with suffix, if no suffix is specified.
  46.  
  47. Am I correct? (I'm an Icon newbie and I'm confused as to whether I'm confused...)
  48. Is the behavior intended?
  49. Should the documentation be corrected?
  50.  
  51. (* BTW 
  52. I'm using Icon 9.0 on MacOS 8 under the MPW Shell.
  53. I'm looking forward to using Icon graphics procedures when 9.3 is done for Macintosh.
  54. I'll implement it myself if necessary but right now I'm working on compiling release 9.0 with MrC.
  55. *)
  56.  
  57. --
  58.   Garry Roseman  <mailto:memphis@macconnect.com>
  59.   Tech Writer & Freelance Programmer
  60.  
  61.  
  62.